/***************************************************************************
 *   Copyright (C) 2007 by ipQalc team                                     *
 *   milambert@c-webhosting.org                                            *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <QtGui>
// #include <QtDebug>
#include "window.h"
#include "about.h"
#include "infoip.h"
#include "maxclient.h"
#include "maxsubnet.h"

// constructeur
Window::Window(QWidget * parent) : QWidget(parent){
    //hbox = new QHBoxLayout;
    QVBoxLayout *vbox = new QVBoxLayout();
    //dialog = new QStackedWidget;
    toolBox = new QToolBox(this);

    //theme (windows)
#ifdef Q_OS_WIN32
    QApplication::setStyle("plastique");
#endif

    toolBox->addItem(new AboutDialog(), tr("About"));
    toolBox->addItem(new InfoIpDialog(), tr("Ip Infos"));
    toolBox->addItem(new MaxClientDialog(), tr("Max client"));
    toolBox->addItem(new MaxSubnetDialog(), tr("Max Subnet"));
    toolBox->setCurrentIndex(0);

    //aboutDig = new AboutDialog;
    //dialog->addWidget(new AboutDialog);
    //dialog->addWidget(new InfoIpDialog);
    //dialog->addWidget(new MaxClientDialog);
    //dialog->addWidget(new MaxSubnetDialog);

    // dialog->adjustSize();
    //hbox->addWidget(createButtonBox());
    //hbox->addWidget(dialog, 1);
    vbox->addWidget(toolBox);
    setLayout(vbox);

    setWindowTitle(tr("IpQalc an ip calculator"));
    resize(640, 480);
}

    
// button box
/*QGroupBox * Window::createButtonBox(){
    QGroupBox *groupButtonBox = new QGroupBox(tr("Menu"), this);

    // creation des diffrents boutons
    QPushButton *infoIpButton = new QPushButton(tr("IP &infos"));
    QPushButton *maxClientButton = new QPushButton(tr("Max &client"));
    QPushButton *maxSubnetButton = new QPushButton(tr("Max &Subnet"));
    QPushButton *aboutButton = new QPushButton(tr("&About"));
    QPushButton *quitButton = new QPushButton(tr("&Quit"));

    //set the buttons tooltips
    infoIpButton->setToolTip("get information of an IP adress");
    maxClientButton->setToolTip("get an IP adress in funtion of maximum numbers of Subnets");
    maxSubnetButton->setToolTip("get an IP adress in funtion of maximum nubers of Host");
    aboutButton->setToolTip("about Ipcalc");
    quitButton->setToolTip("exit IpCalc");

    // creation du container + placer bouttons
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(infoIpButton);
    vbox->addWidget(maxClientButton);
    vbox->addWidget(maxSubnetButton);
    vbox->addWidget(aboutButton);
    vbox->addWidget(quitButton);
    vbox->addStretch(1);
    groupButtonBox->setFixedSize(100, 295);
    groupButtonBox->setLayout(vbox);

    // actions des boutons
    connect(infoIpButton, SIGNAL(clicked()), this, SLOT(infoIp()));
    connect(maxClientButton, SIGNAL(clicked()), this, SLOT(maxClient()));
    connect(maxSubnetButton, SIGNAL(clicked()), this, SLOT(maxSubnet()));
    connect(aboutButton, SIGNAL(clicked()), this, SLOT(about()));
    connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));

    return groupButtonBox;
}*/

/*void Window::about(){
    dialog->setCurrentIndex(0);
}

void Window::infoIp(){
    dialog->setCurrentIndex(1);
}

void Window::maxClient(){
    dialog->setCurrentIndex(2);
}

void Window::maxSubnet(){
    dialog->setCurrentIndex(3);
}*/

Window::~Window(){}
